import [Scope,Errors]
import structs/ArrayList

Value : abstract class {
    line : UInt = 0 // Idicates the line the value was found in the original file (used for errors), 0 for none (for example for built in values)

    toString : abstract func -> String
    equals? : abstract func(other : Value) -> Bool

    evaluate : func(scope : Scope) -> Value {
        this
    }
    
    call : func(arguments : ArrayList<Value>, callScope : Scope) -> Value {
        UncallableError new(toString(),this class,line) throw() // Note that we use this class and not This, as This would always return Value and this class returns the subclass of the value
    }
    
    clone : func -> Value {
        this
    }
}

operator == (right, left : Value) -> Bool {
    right equals?(left)
}

operator != (right, left : Value) -> Bool {
    !right equals?(left)
}